/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.krazevina.kar;

import com.sun.lwuit.Button;
import com.sun.lwuit.Command;
import com.sun.lwuit.Component;
import com.sun.lwuit.Container;
import com.sun.lwuit.Form;
import com.sun.lwuit.Image;
import com.sun.lwuit.Label;
import com.sun.lwuit.TextArea;
import com.sun.lwuit.layouts.BoxLayout;
import com.sun.lwuit.plaf.Style;
import java.io.IOException;

/**
 *
 * @author xtr143
 */
public final class About extends Form{
    Button text1,text2,text3,text4,text5;
    Container grid;
    int w;

    public About(){
        try{
            setLayout(new BoxLayout(BoxLayout.Y_AXIS));
            getStyle().setAlignment(Container.CENTER);
            Container cmp1;
            cmp1 = new Container(new BoxLayout(BoxLayout.X_AXIS));
            Label lbltop;
            lbltop = new Label("My Karaoke List");
            setTopstyle(lbltop);
            lbltop.getDisabledStyle().setAlignment(Container.CENTER);
            lbltop.setPreferredW(getWidth());
            lbltop.setEnabled(false);
            addComponent(lbltop);
            w = getWidth()/2-10;
            setGrid();
            addCmd();
        }catch(Exception e){
        }
    }
    final void setTopstyle(Label lbltop){
        Style s = new Style();
        s.setBackgroundType(Style.BACKGROUND_IMAGE_ALIGNED);
        try {
            Image topfirst;
            topfirst = Image.createImage("/topfirst.png");
            s.setBgImage(topfirst);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        
        s.setBgTransparency(255);
        s.setMargin(20, 0, 0, 0);
        s.setAlignment(Container.CENTER);
        s.setFgColor(0xffffff);
        lbltop.setEnabled(false);
        lbltop.setDisabledStyle(s);
        lbltop.setPreferredW(getWidth());
        lbltop.setPreferredH(45);
    }

    void setmargin(TextArea text1){
        text1.getDisabledStyle().setMargin(20, 0, 0, 0);
    }
    void setmargin(Label text1){
        text1.getDisabledStyle().setMargin(20, 0, 0, 0);
    }
    Command exitCmd,emp;
    void addCmd(){
        try {
            exitCmd = new Command("Thoát", Image.createImage("/btnthoat.png"));
            emp = new Command("", Image.createImage("/btnempty.png"));
            addCommand(exitCmd);
            addCommand(emp);
            Style s = new Style();
            s.setMargin(0,0,0,0);
            s.setPadding(0,0,0,0);
            s.setBorder(null);
            getSoftButton(0).setUnselectedStyle(s);
            getSoftButton(0).setPressedStyle(s);
            getSoftButton(0).setSelectedStyle(s);
            getSoftButton(0).setFocusable(false);
            getSoftButton(1).setUnselectedStyle(s);
            getSoftButton(1).setPressedStyle(s);
            getSoftButton(1).setSelectedStyle(s);
            getSoftButton(1).setFocusable(false);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    protected void actionCommand(Command cmd) {
        super.actionCommand(cmd);
        if(cmd.equals(exitCmd)){
            Main.getInstance().showFirst();
        }
    }
    int i;
    void setGrid(){
        try {
            getStyle().setBgImage(FirstForm.backgr);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        if(grid!=null)removeComponent(grid);
        grid = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        grid.getStyle().setAlignment(Component.CENTER);
        Label lbl,lbldev;
        TextArea l2,l3;
        lbl = new Label("Karaoke v1.0");S.setTrans(lbl);
        lbl.getStyle().setMargin(10, 0, 0, 0);
        lbldev = new Label("NHN Vietnam Company CO.,LTD");S.setTrans(lbldev);
        setmargin(lbldev);
        l2 = new TextArea("Mọi ý kiến đóng góp vui lòng liên hệ:");S.setTrans(l2);
        setmargin(l2);
        l3 = new TextArea("Website: https://sites.google.com/site/karaokenhelp/");S.setTrans(l3);
        grid.addComponent(lbl);
        grid.addComponent(lbldev);
        grid.addComponent(l2);
        grid.addComponent(l3);
        
        
        addComponent(grid);
        repaint();
    }

}
